﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using volva.Models;

namespace volva.Services
{
    public class SeriesService
    {
        /// <summary>
        /// Gets a list of all the series in the database
        /// </summary>
        /// <returns>A objects list with the series in the database</returns>
        static public List<Series> GetList()
        {
            List<Series> allSeries = (from s in DataService.ddc.Series
                                            orderby s.name ascending
                                            select s).ToList();
            return allSeries;
        }

        /// <summary>
        /// Gets a list of all videos in a chosen serie.
        /// </summary>
        /// <param name="serieID">Which serie's videos to show.</param>
        /// <returns>A list of videos in the serie.</returns>
        static public List<Video> videosInSerie(int serieID)
        {
            List<Video> chosenSerie = (from v in DataService.ddc.Videos
                                        where v.id == serieID
                                        select v).ToList();
            return chosenSerie;
        }
        static public Series getSerieById(int id)
        {
            Series serie =
                (from s in DataService.ddc.Series
                 where s.id == id
                 select s).SingleOrDefault();

            return serie;
        }
}
}
